package com.wk.demo;

import java.io.IOError;
import java.io.IOException;
import java.time.DayOfWeek;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wk.data.RandomizedSet;

public class Demo {

	public static void main(String[] args) {
		List<Long> list = new ArrayList<>();
		list.add(10l);
		System.out.println(list);
		Long a = 10l;
		switch (a.intValue()){
			case 10:
				break;
		}
		try {
			throw new IOException("111");
		} 
		catch (IOException e) {
			// TODO: handle exception
			System.out.println("wwww"+1);
		}
		catch (Exception e) {
			// TODO: handle exception
			System.out.println("wwww"+2);
		}
		// TODO Auto-generated method stub
		List<String> list1 = new ArrayList<String>();
		   List<String> list2 = new ArrayList<String>();
		   list1.add("g");
		   list1.add("s");
		   list1.add("a");
		   list1.add("f");
		   
//		   list2.add("g");
//		   list2.add("c");
//		   list2.add("b");
//		   list2.add("a");
		   list2 = list1;
		   boolean flag = list2.retainAll(list1); //求交集
		   System.out.println(list1);
		   System.out.println(list2);
		   System.out.println(flag);
		   System.out.println("------");
		   
		   Map<Long, String> map = new HashMap<Long, String>();
		   map.put(new Long(10000l), "A");
		   System.out.println(map.containsKey(new Long(10000l)));// true
		   
		   Long aLong = 10000l;
		   System.out.println(aLong.toString());
		   
		   RandomizedSet randomizedSet = new RandomizedSet();
		   randomizedSet.insert(1);
		   randomizedSet.insert(2);
//		   randomizedSet.remove(2);
		   System.out.println(randomizedSet.getRandom());
		   System.out.println(randomizedSet.getRandom());
		   System.out.println(randomizedSet.getRandom());
		   Calendar calendar = Calendar.getInstance();
		   calendar.add(Calendar.DATE, -1);
		   Date date = calendar.getTime();
		   System.out.println(new Date().getTime());
		   System.out.println( date.getTime());
		   System.out.println(new Date().getTime() - date.getTime());
		   if(new Date().getTime() - date.getTime() > 1000*60*60*24) {
			   System.out.println("xx");
		   }
		   
		   try {
			System.out.println("1111");
			throw new RuntimeException("111errr");
		} catch (Exception e) {
			throw new RuntimeException("errr");
		} finally {
			System.out.println("2222");
		}
	}

}
